package com.controller;


import com.pojo.User;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;


@RestController
public class UserController extends GenericController{
//    private static final String REST_URL="http://SPRINGCLOUD-DEVT";//通过注册中心获取服务
//    @Autowired
//public RestTemplate restTemplate;
    @Autowired
public ControInterface controInterface;
//    @RequestMapping("/getOne/{id}")
//    public User getOneUser( @PathVariable int id){
//        return  restTemplate.getForObject(REST_URL+"/getOne/"+id,User.class);
//
//    }
//    @RequestMapping("/getAllUser")
//    public List<User> getUser(){
//        return  restTemplate.getForObject(REST_URL+"/getAllUser",List.class);
//    }

    @RequestMapping("/getUserByid2")
    public String getUser(@RequestBody JSONObject id){
        JSONObject jsonObject = JSONObject.fromObject(id);
        return  controInterface.getAllUser(jsonObject);
    }
    @RequestMapping("/getAllUser2")
    public String  getUser2(){
        return  controInterface.getAllUser2();
    }
}
